package com.acme.task1;
public class Task1Calculator {
    public static void main(String[] args) {
        if (args.length != 3) {
            System.out.println("Wrong number of args!");
            return;
        }
        double arg1,arg2;
        try {
        	arg1 = Double.parseDouble(args[0]);
        	arg2 = Double.parseDouble(args[2]);
        } 
        catch (NumberFormatException e) {
        	System.out.println("Wrong number format");
        	return;
        }
    	char op = args[1].charAt(0);
    	if (args[1].length()!=1) {
    		op = '?';
    	}
    	double result;
    	switch (op) {
    		case '+':  
    			result = arg1 + arg2;
    			break;
    		case '-': 
    			result = arg1 - arg2;
    			break;
    		case '*':
    			result = arg1 * arg2;
    			break;
    		case '/':
    			result = arg1 / arg2;    // If arg2 == 0, result will be Infinity, I think that's ok
    			break;
    		default:
    			System.out.println("Wrong operation");
    			return;
    	}
        System.out.println(result);
        
    }
}
